package net.bxx2004.pandalibloader;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginDescription;

import java.io.File;
import java.net.URL;
import java.util.concurrent.ExecutorService;
import java.util.logging.Logger;

import static net.bxx2004.pandalibloader.ServerUtils.*;

public abstract class BungeeCordPlugin extends Plugin {
    @Override
    public void onEnable() {
        register(this);
        message("§b[§f PandaLibLoader §b] §f- §7插件 §f" + this.getDescription().getName() + " §7注册成功 By: §f" + this.getDescription().getAuthor());
        super.onEnable();
    }

    @Override
    public void onDisable() {
        super.onDisable();
    }

    public void register(Plugin plugin){
        if (ProxyServer.getInstance().getPluginManager().getPlugin("PandaLib") == null){
            message("§b[§f PandaLibLoader §b] §f- §7没有发现前置 §bPandaLib §7正在为你下载,请稍后...");
            try {
                download();
                Thread.sleep(10000000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public BungeeCordPlugin() {
        super();
    }

    protected BungeeCordPlugin(ProxyServer proxy, PluginDescription description) {
        super(proxy, description);
    }

    @Override
    public void onLoad() {
        super.onLoad();
    }

    @Override
    public ExecutorService getExecutorService() {
        return super.getExecutorService();
    }

    @Override
    public PluginDescription getDescription() {
        return super.getDescription();
    }

    @Override
    public ProxyServer getProxy() {
        return super.getProxy();
    }

    @Override
    public File getFile() {
        return super.getFile();
    }

    @Override
    public Logger getLogger() {
        return super.getLogger();
    }
}
